from mcp.server.fastmcp import FastMCP

mcp = FastMCP()

# 1.工具
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add tow numbers"""
    return a + b

# 2.资源
@mcp.resource("resource://get_some_words")
def get_some_words() -> str:
    return "hello world"

@mcp.resource("say://{name}")
def say_hello(name: str) -> str:
    return f"say hello to {name}"

# 3.提示词
@mcp.prompt()
def get_history_messages(query: str) -> list[tuple]:
    return [
        ("system", "some words"),
        ("user", query),
        ("assistant", "some response")
    ]

if __name__ == "__main__":
    mcp.run(transport="sse")
    